execs().with_stdout("hello\n"));
assert_that(p.cargo("bench"),
- execs().with_stdout(&format!("\
+ execs().with_stderr(&format!("\
[COMPILING] foo v0.5.0 ({})
-[RUNNING] target[..]release[..]foo-[..]
-
+[RUNNING] target[..]release[..]foo-[..]", p.url()))
+ .with_stdout("
running 1 test
test bench_hello ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-", p.url())));
+"));
});
test!(bench_tarname {
.file("bar/src/lib.rs", "pub fn bar() {}");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({dir})
", dir = p.url())));
assert_that(p.process(&p.bin("foo")),
execs().with_status(0).with_stdout(""));
assert_that(p.cargo("build").arg("--features").arg("bar"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] bar v0.0.1 ({dir}/bar)
[COMPILING] foo v0.0.1 ({dir})
", dir = p.url())));
.file("bar/src/lib.rs", "pub fn bar() {}");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] bar v0.0.1 ({dir}/bar)
[COMPILING] foo v0.0.1 ({dir})
", dir = p.url())));
execs().with_status(0).with_stdout("bar\n"));
assert_that(p.cargo("build").arg("--no-default-features"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({dir})
", dir = p.url())));
assert_that(p.process(&p.bin("foo")),
.file("baz/src/lib.rs", "pub fn baz() {}");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] ba[..] v0.0.1 ({dir}/ba[..])
[COMPILING] ba[..] v0.0.1 ({dir}/ba[..])
[COMPILING] foo v0.0.1 ({dir})
.file("baz/src/lib.rs", "pub fn baz() {}");
assert_that(p.cargo_process("build").arg("--features").arg("bar baz"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] ba[..] v0.0.1 ({dir}/ba[..])
[COMPILING] ba[..] v0.0.1 ({dir}/ba[..])
[COMPILING] foo v0.0.1 ({dir})
"#);
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] d2 v0.0.1 ({dir}/d2)
[COMPILING] d1 v0.0.1 ({dir}/d1)
[COMPILING] foo v0.0.1 ({dir})
.file("a/src/lib.rs", "");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] a v0.1.0 ({dir}/a)
[COMPILING] b v0.1.0 ({dir})
", dir = p.url())));
.file("src/a.rs", "");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({dir})
", dir = path2url(p.root()))));
File::create(&p.root().join("src/a.rs")).unwrap()
.write_all(b"fn main() {}").unwrap();
assert_that(p.cargo("build"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({dir})
", dir = path2url(p.root()))));
.file("tests/test.rs", "");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({dir})
", dir = path2url(p.root()))));
assert_that(p.cargo("test"),
// Make sure the binary is rebuilt, not the lib
assert_that(p.cargo("build")
.env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({dir})
", dir = path2url(p.root()))));
assert_that(&p.bin("foo"), existing_file());
"#)
.file("src/lib.rs", "");
assert_that(p.cargo_process("build").arg("-v"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stderr(&format!("\
[COMPILING] test v0.0.0 ({url})
[RUNNING] `rustc src{sep}lib.rs --crate-name test --crate-type lib \
-C opt-level=1 \
"#)
.file("foo/src/lib.rs", "");
assert_that(p.cargo_process("build").arg("-v").arg("--release"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stderr(&format!("\
[COMPILING] foo v0.0.0 ({url}/foo)
[RUNNING] `rustc foo{sep}src{sep}lib.rs --crate-name foo \
--crate-type dylib --crate-type rlib -C prefer-dynamic \
Package::new("notyet", "0.0.1").publish();
assert_that(p.cargo("package"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stderr(format!("\
[PACKAGING] foo v0.0.1 ({dir})
[VERIFYING] foo v0.0.1 ({dir})
[UPDATING] registry `[..]`
"#);
assert_that(p.cargo_process("run"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0)
+ .with_stderr(&format!("\
[COMPILING] foo v0.0.1 ({dir})
-[RUNNING] `target{sep}debug{sep}foo[..]`
+[RUNNING] `target{sep}debug{sep}foo[..]`", dir = path2url(p.root()), sep = SEP))
+ .with_stdout("\
hello
-",
- dir = path2url(p.root()),
- sep = SEP)));
+"));
assert_that(&p.bin("foo"), existing_file());
});
assert_that(p.cargo_process("rustc").arg("--lib").arg("-v"),
execs()
.with_status(0)
- .with_stdout(format!("\
+ .with_stderr(format!("\
[COMPILING] foo v0.0.1 ({url})
[RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \
--out-dir {dir}{sep}target{sep}debug \
.arg("--").arg("-Z").arg("unstable-options"),
execs()
.with_status(0)
- .with_stdout(format!("\
+ .with_stderr(format!("\
[COMPILING] foo v0.0.1 ({url})
[RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \
-Z unstable-options \
assert_that(foo.cargo_process("rustc").arg("-v").arg("--").arg("-Z").arg("unstable-options"),
execs()
.with_status(0)
- .with_stdout(format!("\
+ .with_stderr(format!("\
[COMPILING] bar v0.1.0 ([..])
[RUNNING] `[..] -g -C [..]`
[COMPILING] foo v0.0.1 ({url})
assert_that(p.cargo_process("rustdoc").arg("-v"),
execs()
.with_status(0)
- .with_stdout(format!("\
+ .with_stderr(format!("\
[DOCUMENTING] foo v0.0.1 ({url})
[RUNNING] `rustdoc src{sep}lib.rs --crate-name foo \
-o {dir}{sep}target{sep}doc \
assert_that(p.cargo_process("rustdoc").arg("-v").arg("--").arg("--no-defaults"),
execs()
.with_status(0)
- .with_stdout(format!("\
+ .with_stderr(format!("\
[DOCUMENTING] foo v0.0.1 ({url})
[RUNNING] `rustdoc src{sep}lib.rs --crate-name foo \
-o {dir}{sep}target{sep}doc \
assert_that(foo.cargo_process("rustdoc").arg("-v").arg("--").arg("--no-defaults"),
execs()
.with_status(0)
- .with_stdout(format!("\
+ .with_stderr(format!("\
[COMPILING] bar v0.0.1 ([..])
[RUNNING] `rustc [..]bar{sep}src{sep}lib.rs [..]`
[DOCUMENTING] foo v0.0.1 ({url})
.arg("--").arg("--no-defaults"),
execs()
.with_status(0)
- .with_stdout(format!("\
+ .with_stderr(format!("\
[DOCUMENTING] bar v0.0.1 ([..])
[RUNNING] `rustdoc [..]bar{sep}src{sep}lib.rs --crate-name bar \
-o {dir}{sep}target{sep}doc \